#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> pii;
const double eps=1e-13;
main(){
  freopen("love.in","r",stdin);
  freopen("love.out","w",stdout);
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int n; bool f=true; cin>>n;
  vector<tuple<int,int,int,int> > a(n);
  for(int i=0;i<n;i++){
    cin>>get<0>(a[i]);
    if(get<0>(a[i])==1)
      cin>>get<1>(a[i])>>get<2>(a[i])>>get<3>(a[i]),f&=get<2>(a[i])==1;
    else cin>>get<1>(a[i]);
  }
  if(f){
    vector<int> v1,v2;
    for(auto i:a){
      if(get<0>(i)==1){
        int x=get<1>(i)+get<3>(i);
        v1.insert(upper_bound(v1.begin(),v1.end(),x),x);
        v2.emplace_back(x);
      }
      else v1.erase(lower_bound(v1.begin(),v1.end(),v2[get<1>(i)-1]));
      int m=v1[v1.size()>>1],c=0;
      for(int i:v1)c+=abs(m-i);
      cout<<c<<'\n';
    }
  }
  else if(n<=5000){
    vector<pii> v;
    vector<bool> ban(n);
    vector<pair<double,double> > vx={make_pair(0,0)};
    int bsc=0;
    for(auto i:a){
      if(get<0>(i)==1){
        int k=-get<2>(i),b=get<3>(i)+get<1>(i)*get<2>(i);
        v.emplace_back(k,b);
        if(k){
          for(auto &i:vx)i.second+=fabs(k*i.first+b);
          double x=-1.0*b/k,c=0;
          for(int i=0;i<v.size();i++)
            if(!ban[i])c+=fabs(v[i].first*x+v[i].second);
          auto p=make_pair(x,c);
          vx.insert(upper_bound(vx.begin(),vx.end(),p),p);
        }
        else bsc+=abs(b);
      }
      else{
        auto d=v[get<1>(i)-1]; ban[get<1>(i)-1]=true;
        if(d.first){
          vx.erase(lower_bound(vx.begin(),vx.end(),make_pair(-1.0*d.second/d.first-eps,-eps)));
          for(auto &i:vx)i.second-=fabs(i.first*d.first+d.second);
        }
        else bsc-=abs(d.second);
      }
      double w=1e16;
      for(auto i:vx)w=min(w,i.second);
      cout<<fixed<<setprecision(8)<<w+bsc<<'\n';
    }
  }
  return 0;
}